<template>
    <div>
        <!-- 合并账号弹窗 -->
        <el-dialog title="合并账号" :visible.sync="Combinedaccount" width="330px" :close-on-click-modal="false" :modal-append-to-body="true" :append-to-body="true" center>
            <p style="min-height: 30px" v-html="Combined.merge"></p>
            <el-button type="primary" class="button_btn widthHeight" @click="CombinedaccountS()" style="margin-left: 40px">确定合并</el-button>
            <el-button type="primary" class="RegisterBottom_Btn2 widthHeight" @click="Combinedaccount = false">取消</el-button>
        </el-dialog>
    </div>
</template>

<script>
import { Combinedaccounts } from '@/api/url'
export default {
  created () { },
  data () {
    return {
      Combinedaccount: false,//是否显示合并账号弹窗
      Combined: '',//合并账号文本
    }
  },
  methods: {
    //确定合并账号
    async CombinedaccountS () {
      // console.log(this.Combined);
      if (this.Combined.type === 1) {
        const res = await Combinedaccounts({ unionid: this.Combined.secret })
        if (res.data.code === 200) {
          this.Combinedaccount = false
          this.$message({ message: '账号合并成功!', type: 'success', center: true })
          this.$EventBus.$emit('callTopGetInfos', 1)//!调用首页的gitInfo方法
        } else if (res.data.code === 500) {
          this.Combinedaccount = false
          this.$message({ message: res.data.msg, type: 'error', center: true })
        }
      } else if (this.Combined.type === 2) {
        const res2 = await Combinedaccounts({ openid: this.Combined.secret })
        if (res2.data.code === 200) {
          this.Combinedaccount = false
          this.$message({ message: '账号合并成功!', type: 'success', center: true })
          this.$EventBus.$emit('callTopGetInfos', 1)//!调用首页的gitInfo方法
        } else if (res2.data.code === 500) {
          this.Combinedaccount = false
          this.$message({ message: res2.data.msg, type: 'error', center: true })
        }
      }
    }
  },
  computed: {},
  watch: {},
  filters: {},
  components: {}
}
</script>

<style scoped lang="less">
/deep/ .el-dialog__body {
    height: 100% !important;
    background: #0d060a;
    background: url('@/assets/dialogImg/hebingzhanghao_bg.png');
    background-size: cover;
}
.widthHeight {
    width: 90px !important;
    height: 38px !important;
}
.RegisterBottom_Btn2 {
    background: rgba(0, 0, 0, 0);
    font-size: 14px;
    font-family: '微软雅黑';
    font-weight: 400;
    color: #fff2dc;
    letter-spacing: 0.28px;
    border: 1px solid #fff2dc;
    border-radius: 4px;
}
.RegisterBottom_Btn2:hover {
    color: #e3d1b1 !important;
    background: rgba(0, 0, 0, 0);
    border: 1px solid #e3d1b1;
}
</style>
